import { http } from '@/utils/http'
import type {
  PasswordSetDto,
  CustomerInfoDto,
  BalanceDto,
  CustomerInfo,
  BindEmailtDto,
} from './info.d'

/** 修改密码 */
export const passwordSet = (data: PasswordSetDto) => {
  return http<boolean>({
    url: '/customer/info/passwordSet',
    data,
    method: 'POST',
  })
}

/** 修改支付密码 */
export const payPasswordSet = (data: PasswordSetDto) => {
  return http<boolean>({
    url: '/customer/info/payPasswordSet',
    data,
    method: 'POST',
  })
}

/** 修改用户信息 */
export const putCustomerInfo = (data: CustomerInfoDto) => {
  return http<CustomerInfo>({
    url: '/customer/info/update',
    data,
    method: 'PUT',
  })
}

/** 绑定邮箱 */
export const bindEmailSet = (data: BindEmailtDto) => {
  return http<string>({
    url: '/customer/info/bindEmailSet',
    data,
    method: 'POST',
  })
}
// 虚假添加余额方法
export const addBalance = (value: number) => {
  return http<boolean>({
    url: `/customer/info/addBalance/${value}`,
    method: 'POST',
  })
}

// 虚假支付
export const balancePay = (data: BalanceDto) => {
  return http<string>({
    url: `/customer/info/pay`,
    data,
    method: 'POST',
  })
}
